<template>
	<view class="pages">
			<view class="itemBox">
				<view class="flex-sub flex flex-direction box2">
					<view class="flex flex-direction flex-sub" @click="handleJump" data-url="/pages/wallet/my-wallet/index">
						<view class="flex justify-between flex-sub">
							<text class="text-333 font-32 text-bold margin-top-8">累计佣金(元)</text>
							<view class="flex align-center">
								<text class="text-666 fu-fs24">详情</text>
								<image src="https://localelife.chunchuangkeji.cn/h5img/images/arrow-r-3.png" style="width: 12rpx;margin-left: 12rpx;margin-top: 4rpx;" mode="widthFix"></image>
							</view>
						</view>
						<text class="text-bold font-40 margin-top-10">{{userInfo.user_money ? Number(userInfo.user_money) : 0}}</text>
					</view>
					<!-- <view class="flex flex-sub flex-direction" @click="handleJump" data-url="/pages/integral/integralgoods/integral-goods-list/index">
						<view class="flex justify-between flex-sub">
							<text class="text-333 font-32 text-bold margin-top-8">积分收益</text>
							<view class="flex align-center" style="margin-top: 4rpx;">
								<text class="text-666 fu-fs24">详情</text>
								<image src="https://localelife.chunchuangkeji.cn/h5img/images/arrow-r-3.png" style="width: 12rpx;margin-left: 12rpx;margin-top: 4rpx;" mode="widthFix"></image>
							</view>
						</view>
						<text class="text-bold font-40 margin-top-10">{{userInfo.score ? userInfo.score : 0}}</text>
					</view> -->
				</view>
				<view class="box2 flex-sub" v-if="is_show != 1">
					<view class="flex justify-between padding-bottom-20" @click="handleJump" data-url="/pages/distribution/distribution/promoters/index">
						<text class="text-bold fu-fs32">我的团队</text>
						<view class="flex align-center">
							<text class="text-666 fu-fs24">详情</text>
							<image src="https://localelife.chunchuangkeji.cn/h5img/images/arrow-r-3.png" style="width: 12rpx;margin-left: 12rpx;margin-top: 4rpx;" mode="widthFix"></image>
						</view>
					</view>
					<view class="flex align-center padding-b-16 justify-between fu-fs28">
						<text class="text-666">总人数</text>
						<text class="text-bold">{{dataContent.trecommend}}</text>
					</view>
					<view class="flex align-center padding-b-16 justify-between fu-fs28">
						<text class="text-666">一级人数</text>
						<text class="text-bold">{{dataContent.recommend_count1}}</text>
					</view>
					<view class="flex align-center justify-between fu-fs28">
						<text class="text-666">二级人数</text>
						<text class="text-bold">{{dataContent.recommend_count2}}</text>
					</view>
				</view>
			</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				dataContent: {},
				is_show:0,
			};
		},
		computed: {
			
			userInfo() {
				let info = this.$store.getters.userInfo ? this.$store.getters.userInfo : {}
				return info;
			},
			isLogin() {
				return this.$store.getters.isLogin;
			},
			isMember() {
				return this.$store.getters.isMember;
			},
		},
		onLoad() {
			this.is_show = '1'
			this.getHiddenInterface()
			
		},
		onShow() {
			if (this.isLogin) {
				this.getContent();
			} else {
				this.ordernum = {
					deliver: 0,
					evaluate: 0,
					finish: 0,
					msg_num: 0,
					no_pay: 0
				};
				this.dataContent = {
					trecommend: 0,
					recommend_count1: 0,
					recommend_count2: 0
				}
			}
		},
		methods:{
			// 上架隐藏
			getHiddenInterface(){
				this.$api.post(global.apiUrls.hiddenInterface,{code: 'is_show'}).then(res=>{
					if(res.data.code == 1){
						this.is_show = res.data.data
						if(res.data.data == 1){
							uni.setTabBarItem({
										  index: 1,
											visible:false
							})
						}else{
							uni.setTabBarItem({
										  index: 1,
											visible:true
							})
						}
					}
				})
			},
			getContent() {
			  this.$api.post(global.apiUrls.post5fe69d2d1acb9).then(res => {
			      console.log('推广人统计', res);
			      if (res.data.code == 1) {
			        this.dataContent = res.data.data
			      } else {
			        this.$message.error(res.data.msg)
			      }
			    })
			    .catch(err => {
			      console.log(err);
			    })
			},
		}
	}
</script>

<style lang="scss">
// page{
// 	background: #fff;
// }
.itemBox{
	display: flex;
}
.box2{
	margin: 24rpx;
	padding: 24rpx;
	border-radius: 8rpx;
	background: #fff;
}
</style>
